package com.jgy.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jgy.entity.SpaceUser;
import com.jgy.entity.Systemlogexception;
import com.jgy.entity.vo.LogCountVo;
import com.jgy.entity.vo.ShopMesVo;
import com.jgy.service.SystemlogexceptionService;
import com.jgy.mapper.SystemlogexceptionMapper;
import com.jgy.utils.SecurityUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author light
* @description 针对表【systemlogexception(系统异常日志表)】的数据库操作Service实现
* @createDate 2023-03-31 15:35:43
*/
@Service
public class SystemlogexceptionServiceImpl extends ServiceImpl<SystemlogexceptionMapper, Systemlogexception>
    implements SystemlogexceptionService{

    @Autowired
    private SystemlogexceptionMapper systemlogexceptionMapper;

    /**
     * 统计用户商品相关信息
     * @return ShopMesVo
     */
    @Override
    public ShopMesVo countShopMes() {
        SpaceUser user = SecurityUtil.getUser();
        assert user != null;
        ShopMesVo shopMesVos = systemlogexceptionMapper.countShopMes(user.getUsername());
        List<LogCountVo> logCountVos = systemlogexceptionMapper.countShop(user.getUsername());
        shopMesVos.setShopList(logCountVos);
        return shopMesVos;
    }

    @Override
    public List<LogCountVo> countErrorLog() {
        return systemlogexceptionMapper.countErrorLog();
    }
}




